 #include "util.hpp"
 #include <string>
 #include <cstring>
 #include <vector>
 #include <functional>
 
 using namespace std;
 using namespace Util;

using func_t = std::function<void()>;

void show()
{
    cout << "正在处理其它的事情" << endl;
}

 int main()
 {
    std::vector<func_t> funcs;
    funcs.push_back(show);

    SetNonBlock(0);

    char buffer[1024];
    while(true)
    {
        buffer[0] = 0;
        int n = scanf("%s", buffer);
        if(n == -1)
        {
            cout << "errno: " << errno << " desc: " << strerror(errno) << endl;
            for(const auto &f : funcs)
            {
                f();
            }
        }
        else
        {
            cout << "刚刚获取的内容是# " << buffer << endl;
        }
        sleep(1);
    }

    return 0;
 }